package dataStructureAlgorithms.binaryTree;

import java.util.Objects;

/**
 * @description: TODO 节点
 * @author: wzj
 * @create: 2019/5/17 9:09
 */
public class Node {
    private int data;
    private Node leftNode,rightNode;

    public Node(int data) {
        this.data = data;
    }

    public int getData() {
        return data;
    }

    public void setData(int data) {
        this.data = data;
    }

    public Node getLeftNode() {
        return leftNode;
    }

    public void setLeftNode(Node leftNode) {
        this.leftNode = leftNode;
    }

    public Node getRightNode() {
        return rightNode;
    }

    public void setRightNode(Node rightNode) {
        this.rightNode = rightNode;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Node node = (Node) o;
        return data == node.data &&
                Objects.equals(leftNode, node.leftNode) &&
                Objects.equals(rightNode, node.rightNode);
    }

    @Override
    public int hashCode() {

        return Objects.hash(data, leftNode, rightNode);
    }
}
